package com.lmc.log.function;

import com.lmc.log.bean.TrafficFlow;
import org.apache.flink.api.common.functions.ReduceFunction;

public class FlowReportReduceFunction implements ReduceFunction<TrafficFlow> {

    @Override
    public TrafficFlow reduce(TrafficFlow trafficFlow, TrafficFlow bean) throws Exception {
        // todo trafficFlow：表示增加计算中间结果；bean：表示窗口中每条数据
        // 增量计算
        trafficFlow.setLicensePlateCount(trafficFlow.getLicensePlateCount() + bean.getLicensePlateCount());
        // 返回结果
        return trafficFlow;
    }
}
